[VC++]请问这段代码错在哪儿?

来源:百度知道 编辑:UC知道 时间:2024/05/23 18:45:47
#include "stdafx.h"
#include "A.h"
#using <mscorlib.dll>
using namespace System;

注:"A.h"是我自己写的一个头文件.
错误提示:缺少";"(在using前面)
同一个程序里的另一个源文件开头也是这样写的,却可以编译通过..

原因很简单,就是你在“A.h”中定义了一个class,但是在最后的右括号(‘}’)后你丢了“;”,即类的定义是这样的:
class Sample{
//变量很函数
//。。。。
}; //你是不是没有这个“;”号啊,呵呵。

祝你学习C++愉快!

您看一下是不是应该这样:
#include "stdafx.h"
#include "A.h"
#import <mscorlib.dll>
using namespace System;

前三行后面有没有分号的?我不大记得了。